<?php
declare (strict_types=1);

namespace quick\admin\components;


use quick\admin\Element;

class SettingItem extends Element
{

    public $component = "admin-setting";


    protected array $actions = [];


    /**
     * @param $action
     * @return $this
     */
    public function addAction($action)
    {
        if(!is_array($action)){
            $action = [$action];
        }
        $this->actions = array_merge($this->actions,$action);
        return $this;
    }

    public function getChildrenComponents()
    {
        return array_merge(parent::getChildrenComponents(),$this->actions); // TODO: Change the autogenerated stub
    }

    public function jsonSerialize()
    {
        $this->props('actions',$this->actions);
        return parent::jsonSerialize();
    }
}
